<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 <head>
     <link rel="stylesheet" href="/admin/css/pintuer.css"/>
     <link rel="stylesheet" href="/admin/css/admin.css"/>
     <link  href="/admin/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
     <link href="/admin/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all" />
     <script src="/admin/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
     <script src="/admin/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
     <script src="/admin/js/pintuer.js"></script>
     <script type="text/javascript" charset="utf-8">
         function getXHR() {//返回XMLHttpRequest
             if(window.XMLHttpRequest) {//W3C标准的浏览器获取
                 return new XMLHttpRequest();
             } else {//ie浏览器适配
                 return new window.ActiveXObject("Microsoft.XMLHTTP");
             }
         }
         // document.write(getXHR());
     </script>
</head>
<body>
<form method="get" action="/admin/review/index">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 评论管理</strong></div>
    <div class="padding border-bottom">
      <ul class="search">
          <li>
              <label><input type="checkbox" class="check-box" name="state" value="0" th:checked="${state!=null and state==0}">只看未审核</label>
          </li>
          <li> <button class="btn btn-success">查询</button></li>
      </ul>
    </div>
    <table class="table table-hover text-center">
        <thead>
            <tr>
                <th>用户名</th>
                <th>昵称</th>
                <th>电影</th>
                <th class="col-md-4">评论内容</th>
                <th>评论时间</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>
     <tbody>
        <tr th:each="r:${page.records}" th:object="${r}">
            <td th:text="*{user.username}"></td>
            <td th:text="*{user.nickname}"></td>
            <td th:text="*{film.name}"></td>
            <td th:text="*{content}"></td>
            <td th:text="*{#dates.format(createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
            <td>
                <span th:if="*{state==0}" class="text-info">未审核</span>
                <span th:if="*{state==1}" class="text-success" >审核通过</span>
                <span th:if="*{state==2}" class="text-danger" >审核未通过</span>
            </td>
            <td>
                <a class="btn btn-success" th:href="'/admin/review/pass/'+*{id}"><span class="icon-star"></span>通过审核</a>
                <a class="btn btn-danger" th:href="'/admin/review/unpass/'+*{id}">未通过审核</a>
           </td>
        </tr>
     </tbody>
      <tr>
        <td colspan="8">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li style="border: none">
                        <a th:href="|/admin/review/index?pn=${page.current-1}|" aria-label="Previous" th:if="${page.current>1}">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li style="border: none" th:class="${pn==page.current?'active':''}" th:each="pn:${#numbers.sequence(1,page.pages)}">
                        <!--                        <a th:href="|/admin/film/index?pn=${pn}|" th:text="${pn}">1</a></li>-->
                        <a th:href="'/admin/review/index?pn='+${pn}" th:text="${pn}">1</a></li>
                    <li style="border: none">
                        <a th:href="|/admin/review/index?pn=${page.current+1}|" aria-label="Next" th:if="${page.current<page.pages}">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
		</td>
      </tr>
    </table>
  </div>
</form>
<script type="text/javascript">
    function showBI(element){
       let briefIntro = $(element).prev().text();
       $("#myModal .modal-body p").text(briefIntro);
    }
</script>
</body>
</html>